ig.module(
	'game.entities.base.baseFood'
)
.requires(
	'impact.entity',
        'game.entities.base.dragme'
)
.defines(function()
{    
    EntityBaseFood = EntityDragme.extend(
    {     
	collides: ig.Entity.COLLIDES.PASSIVE,	        
	pickType: 'none',
	picked: false,
	zIndex: 1,
	
	init: function(x, y, settings)
	{
	    this.parent(x, y, settings);
	    this.vel.x = 0;
	    this.vel.y = 0;
	},
	
	update: function()
	{
	    this.parent();
	    if (ig.input.released('mouse_left'))
	    {			    
		var spots = ig.game.getEntitiesByType(EntitySpot);		    
		
		for (var i = 0; i < spots.length; ++i)
		{
		    if (this.touches(spots[i]) == true || spots[i].touches(this))
		    {
			if (this.picked == false)
			{
			    if (spots[i].typeToPick == this.pickType)
			    {
				this.pos.x += ig.input.mouse.x - this.lastMouseX;
				this.pos.y += ig.input.mouse.y - this.lastMouseY;
				this.resetPos = false;
				this.picked = true;
				ig.global.numberOfPicks++;
				break;
			    }
			    else
			    {
				ig.global.failed = true;
			    }
			}		    		
		    }		    
		}					
	    }
	},
    });
});